<?php

class ValidationTools {
  /**
   * Gets directories where validation files are stored for a given module.
   *
   * @param string The module name
   *
   * @return array An array of directories
   */
  static public function getValidationDirs($moduleName)
  {
    $suffix = $moduleName.'/'.sfConfig::get('sf_app_module_validate_dir_name');

    $dirs = array();
    foreach (sfConfig::get('sf_module_dirs', array()) as $key => $value)
    {
      $dirs[$key.'/'.$suffix] = $value;
    }

    $dirs[sfConfig::get('sf_app_module_dir').'/'.$suffix] = false;                                     // application

    if ($pluginDirs = glob(sfConfig::get('sf_plugins_dir').'/*/modules/'.$suffix))
    {
      $dirs = array_merge($dirs, array_combine($pluginDirs, array_fill(0, count($pluginDirs), true))); // plugins
    }

    $dirs[sfConfig::get('sf_symfony_data_dir').'/modules/'.$suffix] = true;                            // core modules

    return $dirs;
  }
  
}